package com.ruoyi.web.controller.base;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.base.domain.BusWaterQualitystandard;
import com.ruoyi.base.service.IBusWaterQualitystandardService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 水质标准数据Controller
 * 
 * @author ruoyi
 * @date 2025-10-19
 */
@RestController
@RequestMapping("/base/qualitystandard")
public class BusWaterQualitystandardController extends BaseController
{
    @Autowired
    private IBusWaterQualitystandardService busWaterQualitystandardService;

    /**
     * 查询水质标准数据列表
     */
//    @PreAuthorize("@ss.hasPermi('system:QUALITYSTANDARD:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusWaterQualitystandard busWaterQualitystandard)
    {
        startPage();
        List<BusWaterQualitystandard> list = busWaterQualitystandardService.selectBusWaterQualitystandardList(busWaterQualitystandard);
        return getDataTable(list);
    }

    /**
     * 导出水质标准数据列表
     */
//    @PreAuthorize("@ss.hasPermi('system:QUALITYSTANDARD:export')")
//    @Log(title = "水质标准数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusWaterQualitystandard busWaterQualitystandard)
    {
        List<BusWaterQualitystandard> list = busWaterQualitystandardService.selectBusWaterQualitystandardList(busWaterQualitystandard);
        ExcelUtil<BusWaterQualitystandard> util = new ExcelUtil<BusWaterQualitystandard>(BusWaterQualitystandard.class);
        util.exportExcel(response, list, "水质标准数据数据");
    }

    /**
     * 获取水质标准数据详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:QUALITYSTANDARD:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busWaterQualitystandardService.selectBusWaterQualitystandardById(id));
    }

    /**
     * 新增水质标准数据
     */
//    @PreAuthorize("@ss.hasPermi('system:QUALITYSTANDARD:add')")
//    @Log(title = "水质标准数据", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody BusWaterQualitystandard busWaterQualitystandard)
    {
        return toAjax(busWaterQualitystandardService.insertBusWaterQualitystandard(busWaterQualitystandard));
    }

    /**
     * 修改水质标准数据
     */
//    @PreAuthorize("@ss.hasPermi('system:QUALITYSTANDARD:edit')")
//    @Log(title = "水质标准数据", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody BusWaterQualitystandard busWaterQualitystandard)
    {
        return toAjax(busWaterQualitystandardService.updateBusWaterQualitystandard(busWaterQualitystandard));
    }

    /**
     * 删除水质标准数据
     */
//    @PreAuthorize("@ss.hasPermi('system:QUALITYSTANDARD:remove')")
//    @Log(title = "水质标准数据", businessType = BusinessType.DELETE)
	@GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busWaterQualitystandardService.deleteBusWaterQualitystandardByIds(ids));
    }
}
